// +----------------------------------------------------------------------
// | Copyright (c) 2015-2025 http://www.hdphp.cn All rights reserved.
// | Licensed ( http://www.hdphp.cn/licenses/ )
// | Author: Jack <sophia2152@qq.com>
// | 官方网址: http://www.hdphp.cn
// | 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用。
// | 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
// +----------------------------------------------------------------------
import { BasicColumn, FormSchema } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: 'ID',
    dataIndex: 'id',
    width: 50,
  },
  {
    title: 'ID/名称',
    width: 100,
    customRender: ({ record }) => {
      return record.admin_id ? '' + record.admin_id + '/  ' + record.username : record.username;
    },
  },
  {
    title: '姓名',
    dataIndex: 'true_name',
    width: 100,
  },
  {
    title: '链接',
    width: 120,
    customRender: ({ record }) => {
      return record.method ? '/' + record.method + '/' + record.path : record.path;
    },
  },
  {
    title: '行为',
    dataIndex: 'page',
    width: 100,
  },
  {
    title: '位置/操作ip',
    width: 100,
    customRender: ({ record }) => {
      return record.ip_data ? '[' + record.ip_data + ']  ' + record.ip : record.ip;
    },
  },
  {
    title: '类型',
    dataIndex: 'type',
    width: 80,
  },
  {
    title: '操作时间',
    dataIndex: 'create_time',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'data',
    label: '选择时间',
    component: 'RangePicker',
    colProps: { span: 6 },
  },
  {
    field: 'path',
    label: '链接',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'ip',
    label: 'IP',
    component: 'Input',
    colProps: { span: 6 },
  },
];
